package com.google.gac.masai.getit;

import android.app.SearchManager;
import android.net.Uri;
import android.provider.BaseColumns;

/**
 * Defines a contract between the DownloadLog content provider and its clients.
 * A contract defines the information that a client needs to access the provider
 * as one or more data tables. A contract is a public, non-extendable (final)
 * class that contains constants defining column names and URIs. A well-written
 * client depends only on the constants in the contract.
 */
public final class DownloadLog {
	public static final String AUTHORITY = "com.google.provider.DownloadLog";

	// This class cannot be instantiated
	private DownloadLog() {
	}

	/**
	 * Logs table contract
	 */
	public static final class Logs implements BaseColumns {
		
		// This class cannot be instantiated
		private Logs() {

		}
		
		/**
		 * The table name offered by this provider
		 */
		public static final String TABLE_NAME = "logs";

		/*
		 * URI definitions
		 */

		/**
		 * The scheme part for this provider's URI
		 */
		private static final String SCHEME = "content://";

		/**
		 * Path parts for the URIs
		 */

		/**
		 * Path part for the LOGs URI
		 */
		private static final String PATH_LOGS = "/logs";

		/**
		 * Path part for the LOG ID URI
		 */
		private static final String PATH_LOG_ID = "/logs/";

		/**
		 * 0-relative position of a LOG ID segment in the path part of a LOG ID
		 * URI
		 */
		public static final int LOG_ID_PATH_POSITION = 1;

		/**
		 * The content:// style URL for this table
		 */
		public static final Uri CONTENT_URI = Uri.parse(SCHEME + AUTHORITY
				+ PATH_LOGS);

		/**
		 * The content URI base for a single LOG. Callers must append a numeric
		 * LOG id to this Uri to retrieve a LOG
		 */
		public static final Uri CONTENT_ID_URI_BASE = Uri.parse(SCHEME
				+ AUTHORITY + PATH_LOG_ID);

		/**
		 * The content URI match pattern for a single LOG, specified by its ID.
		 * Use this to match incoming URIs or to construct an Intent.
		 */
		public static final Uri CONTENT_ID_URI_PATTERN = Uri.parse(SCHEME
				+ AUTHORITY + PATH_LOG_ID + "/#");

		/*
		 * MIME type definitions
		 */

		/**
		 * The MIME type of {@link #CONTENT_URI} providing a directory of LOGs.
		 */
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.log";

		/**
		 * The MIME type of a {@link #CONTENT_URI} sub-directory of a single
		 * LOG.
		 */
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.google.log";

		/**
		 * The default sort order for this table
		 */
		public static final String DEFAULT_SORT_ORDER = "modified ASC";

		/*
		 * Column definitions
		 */
		// TODO Check the accuracy
		/**
		 * Column name for the title of the LOG
		 * <P>
		 * Type: TEXT
		 * </P>
		 */
		public static final String COLUMN_NAME_TITLE = "filename";

		/**
		 * Column name for the title of the LOG
		 * <P>
		 * Type: TEXT
		 * </P>
		 */
		public static final String COLUMN_NAME_URI = "uri";

		/**
		 * Column name of the LOG content
		 * <P>
		 * Type: TEXT
		 * </P>
		 */
		public static final String COLUMN_NAME_TAG = "tag";

		/**
		 * Column name for the creation timestamp
		 * <P>
		 * Type: INTEGER (long from System.curentTimeMillis())
		 * </P>
		 */
		public static final String COLUMN_NAME_CREATE_DATE = "created";

		/**
		 * Column name for the modification timestamp
		 * <P>
		 * Type: INTEGER (long from System.curentTimeMillis())
		 * </P>
		 */
		public static final String COLUMN_NAME_MODIFICATION_DATE = "modified";

	}
}